const express = require('express');
const axios = require("axios");
const crypto = require("crypto");
const router = express.Router();


//数据中台学生信息接口地址
const raydataURL = 'http://172.16.5.145:19107/big-data-order-download/v3/api/postApi/5CFDB5F0F5BCDF552D112D4866CC5990';
//通过post请求接收请求数据
router.post('/', async (req, res) => {
    const postData = req.body;
    console.log(postData);
    //拿到请求数据后通过axios向数据中台接口发送post请求
    try{
        const response = await axios.post(raydataURL,postData,{
            headers:{
                'Content-Type': 'application/json',
                'appid': 'admin',
                'secret': 'Swksh@2024'
            }
        });
        res.json(response.data);
        console.log(response.data.data);
    }catch(err){
        console.log('出错！',err);
    }
});
module.exports = router;

//解析AES数据
function decodeData(data,key,iv){
    const decode = crypto.createDecipheriv('aes-256-cbc',key);
}